package com.joysuch.wwyt.core.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.Proxy;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

import java.io.Serializable;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_base_credit_card_record")
@SQLDelete(sql = "update wwyt_base_credit_card_record set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_base_credit_card_record set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Proxy(lazy = false)
@Data
public class BaseCreditCardRecord implements Serializable {
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("主键id")
    private Long id;

    @ApiModelProperty("0卡口,1车辆")
    private Integer typeFlag;

    @ApiModelProperty("记录id")
    private Integer code;

    @ApiModelProperty("服务公司")
    private String sunitName;

    @ApiModelProperty("卡号")
    private String cardCode;

    @ApiModelProperty("门禁通道")
    private String guardChannel;

    @ApiModelProperty("刷卡时间")
    private Date slotCardTime;

    @ApiModelProperty("进出标记")
    private String inOutTag;

    @ApiModelProperty("刷卡成功")
    private String creditCardTag;

    @ApiModelProperty("人员类型:数据字典id")
    private Long userTypeId;

    @ApiModelProperty("人员类型名称")
    private String userTypeName;

    @ApiModelProperty("所属公司/承揽商")
    private String companyName;

    @ApiModelProperty("职号/证件号码")
    private String idNumber;

    @ApiModelProperty("姓名")
    private String userName;

    @ApiModelProperty("备注说明")
    private String remark;

    @ApiModelProperty("车牌号码")
    private String carNumber;

    //通用字段
    @ApiModelProperty("创建人")
    @org.springframework.data.annotation.CreatedBy
    private Long createBy;

    @ApiModelProperty("创建时间")
    @org.springframework.data.annotation.CreatedDate
    private Date createTime;

    @ApiModelProperty("更新人")
    @org.springframework.data.annotation.LastModifiedBy
    private Long updateBy;

    @ApiModelProperty("更新时间")
    @org.springframework.data.annotation.LastModifiedDate
    private java.time.LocalDateTime updateTime;

    @ApiModelProperty("租户")
    private Long tenentId;

    @ApiModelProperty("组织机构代码")
    private String orgCode;

    @ApiModelProperty("删除标记")
    private String deleteFlag;
}
